-
Notifications
You must be signed in to change notification settings - Fork 816
Avoid unnecessary conversions between model.Metric and labels.Labels #6710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Xiaochao Dong (@damnever) <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great change. Have you tried to benchmark it and see how much it helps?
Signed-off-by: Xiaochao Dong (@damnever) <[email protected]>
@yeya24 I haven't conducted a benchmark |
Not a serious benchmark, but the latency decreases by ~17% when I query 700k series manually.. I also slightly modified this benchmark, which has shown some improvements. - assert.Contains(b, []int{numIngesters, numIngesters - 1}, countMockIngestersCalls(ingesters, "MetricsForLabelMatchers"))
- assert.Equal(b, numSeriesPerRequest, len(metrics))
+ // assert.Contains(b, []int{numIngesters, numIngesters - 1}, countMockIngestersCalls(ingesters, "MetricsForLabelMatchers"))
+ // assert.Equal(b, numSeriesPerRequest, len(metrics))
+ _ = ingesters
+ seriesSet := series.MetricsToSeriesSet(ctx, false, metrics)
+ for seriesSet.Next() {
+ _ = seriesSet.At()
+ }
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Thanks
What this PR does:
Remove complex conversions when selecting only series:
LabelAdapters
->model.Metric(map)
->labels.Labels
.Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]